/*
     Copyright 2007 Joseph M. Ferner

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

using System;
using log4net;
using log4net.Config;
using OpenServers.Net.Common.FileSystem.Disk;
using OpenServers.Net.Common.Listener;
using OpenServers.Net.Common.Security;

namespace OpenServers.Net.HttpServer {
    public class Program {
        private static readonly ILog log = LogManager.GetLogger(typeof(Program));

        static void Main(string[] args) {
            XmlConfigurator.Configure();

            log.Debug("starting server");
            HttpServer server = new HttpServer();
            server.Listeners.Add(new NonsecureTcpListener(HttpServer.DEFAULT_NONSECURE_PORT));
            server.FileSystem = new DiskFileSystem("c:\\temp");
            server.SecurityProvider = new OpenSecurityProvider();
            server.Start();
            log.Debug("server started");
            Console.WriteLine("press 'q' to quit.");
            while (true) {
                ConsoleKeyInfo key = Console.ReadKey();
                if (key.KeyChar == 'q')
                    break;
            }
            server.Stop();
        }
    }
}
